import type TableColumn from "@/components/table/type/TableColumn.ts";
import type FormItem from "@/components/form/type/FormItem.ts";

/**
 * 查询条件表单结构数据
 */
export const searchSchema: FormItem[] = [
    {row: 0, span: 4, label: "资源名称", key: "permissionName", type: "input"},

    {row: 0, span: 4, label: "操作", key: "operate", type: "slot"},
]

/**
 * 表格结构数据
 */
export const tableColumns: TableColumn[] = [
    {key: "id", title: "序号", width: 80, type: "index"},
    {key: "permissionName", title: "资源名称", align: "center", type: "string"},
    {key: "permissionCode", title: "资源唯一编码", align: "center", type: "string"},
    {
        key: "permissionType", title: "资源类型", align: "center", type: "number", callback: row => {
            switch (row.permissionType) {
                case 1:
                    return "接口"
                case 2:
                    return "页面"
                case 3:
                    return "页面元素"
            }
        }
    },
    {key: "component", title: "前端组件地址", align: "center", type: "string"},
    {key: "icon", title: "图标", align: "center", type: "slot"},
    {
        key: "visible",
        title: "是否可见",
        align: "center",
        type: "slot",
        callback: row => row.visible ? "可见" : "不可见"
    },
    {key: "sort", title: "排序", align: "center", type: "number"},

    {key: "operate", title: "操作", width: 200, type: "slot", align: "center"},
]

/**
 * dialog结构数据
 */
export const dialogScheme: FormItem[] = [
    {row: 0, span: 12, label: "父资源名称", key: "pid_dict", placeholder: "父资源名称", type: "input", disabled: true},
    {row: 0, span: 12, label: "资源名称", key: "permissionName", placeholder: "资源名称", type: "input"},
    {row: 1, span: 12, label: "资源编码", key: "permissionCode", placeholder: "资源编码", type: "input"},
    {
        row: 1,
        span: 12,
        label: "资源类型",
        key: "permissionType",
        placeholder: "资源类型",
        type: "select",
        options: [
            {label: "接口", value: 1},
            {label: "页面", value: 2},
            {label: "页面元素", value: 3}
        ]
    },
    {row: 2, span: 12, label: "组件地址", key: "component", placeholder: "组件地址", type: "input"},
    {row: 2, span: 12, label: "资源图标", key: "icon", placeholder: "图标", type: "input"},
    {row: 3, span: 12, label: "排序", key: "sort", placeholder: "排序", type: "number"},
    {row: 3, span: 12, label: "是否可见", key: "visible", placeholder: "是否可见", type: "switch"},
]